<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 100px;
            height: 100px;
            border: 1px solid;
        }
        h1{

        }
    </style>
</head>
<body>
    <h1>
    <div>鼠标事件</div>
    </h1>
    <script>
        let div = document.querySelector('div')
        div.onclick=function(){
            console.log('点击事件');   
        }
        div.onmousedown=function(){
            console.log('鼠标按下');   
        }
        div.onmouseup=function(){
            console.log('鼠标抬起');   
        }
        div.onmouseover=function(){//会冒泡
            console.log('鼠标移入');   
        }
        div.onmouseout=function(){//会冒泡
            console.log('鼠标移出');   
        }
        div.onmouseenter=function(){
            console.log('鼠标移入，不冒泡');   
        }
        div.onmouseleave=function(){
            console.log('鼠标移出，不冒泡');   
        }
        let h1 =document.querySelector('h1')
            h1.onmouseenter = function(){  //会冒泡
                 console.log('h1鼠标移入');
                
            }
    </script>
</body>
</html>